<template>
	<view class="box">
		<uNavbar title="成交趋势"></uNavbar>
		<view class="top_main">
			<view class="top_main_left">
				<view class="top_main_left_top">
					<image src="/static/icon/cjq.png" mode=""></image>
					<text>最新成交价</text>
				</view>
				<view class="top_main_left_bottom">
					<image src="../../static/icon/i_money.png" mode=""></image>
					<text>{{listone.new_price}}</text>
				</view>
			</view>
			<view class="top_main_right">
				<view class="top_main_right_left">
					<view class="top_main_right_item">
						<text class="text">最高成交价</text>
						<view class="price">
							<image src="../../static/icon/i_money.png" mode=""></image>
							<text>{{listone.max_price}}</text>
						</view>
					</view>
					<view class="top_main_right_item">
						<text class="text">今日最低</text>
						<view class="price">
							<image src="../../static/icon/i_money.png" mode=""></image>
							<text>{{listone.today_min_price}}</text>
						</view>
					</view>
				</view>
				<view class="top_main_right_left">
					<view class="top_main_right_item">
						<text class="text">今日成交量</text>
						<view class="price">
							<text>{{listone.today_pay_number}}</text>
						</view>
					</view>
					<view class="top_main_right_item">
						<text class="text">历史最低</text>
						<view class="price">
							<image src="../../static/icon/i_money.png" mode=""></image>
							<text>{{listone.min_price}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="tit">
			流转记录
		</view>
		<view class="main_item"  v-for="item in orderlist" :key="item.id" >
			<view class="main_item_top" >
				<text class="text">{{item.goods_name}}</text>	<text class="text2">{{item.goods_number}}/{{item.circulation}}</text>
			</view>
			<view class="main_item_bottom">
				<text class="text_one">成交时间：{{item.create_time}}</text>
				<view class="price_wrap">
					<image src="../../static/icon/i_money.png" mode=""></image>
					<text>{{item.price}}</text>
				</view>
			</view>
		</view>
		<noDatas :xxxList="orderlist" :status="status"></noDatas>
		<view style="width: 750rpx;height: 48rpx;">
			
		</view>
	</view>
</template>

<script>
	import {trend} from "../../api/object.js"
		export default {
			data() {
				return {		
					id:0,
					orderlist:[],
					listone:[],
					page: 1,
					size: 20,
					status: 'loadmore', //加载前值为loadmore，加载中为loading，没有数据为nomore
				}
			},
			onLoad(options) {
				this.id=options.id
				this.getorderList()
			},
			methods: {
				getorderList(){
					trend({
						goods_id:this.id,
						page:this.page
					}).then(res=>{
						if (res.code == 1) {
							if(this.page==1){
								this.listone=res.data
							}
							console.log(this.listone)
							let list = res.data.goods_log.data;
							this.orderlist = this.page == 1 ? list : this.orderlist.concat(list);
							console.log(this.orderlist,999);
							if (list.length < this.size) this.status = 'nomore';
							else this.status = 'loading';
						}
				
					})
				},
			},
			onReachBottom() {
				if (this.status != 'nomore') {
					this.page = this.page + 1
					this.getorderList()
				}
			},

		}
</script>

<style scoped lang="scss">
	.top_main{
		width: 690rpx;
		height: 240rpx;
		background: #F2F2F2;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		margin: 0 auto;
		margin-top: 50rpx;
		display: flex;
		.top_main_left{
			width: 300rpx;
			height: 240rpx;
			display: flex;
			flex-direction: column;
			
			.top_main_left_top{
				display: flex;
				align-items: center;
				margin-top: 72rpx;
				margin-left: 32rpx;
				>image{
					width: 36rpx;
					height: 36rpx;
					margin-right: 12rpx;
				}
				>text{
					font-weight: 400;
					font-size: 32rpx;
					color: #A68A64;
				}
			}
			.top_main_left_bottom{
				display: flex;
				align-items: center;
				margin-left: 32rpx;
				margin-top: 20rpx;
				>image{
					width: 34rpx;
					height: 34rpx;
				}
				>text{
					font-weight: 500;
					font-size: 48rpx;
					color: #A68A64;
					margin-left: 10rpx;
				}
			}
		}
		.top_main_right{
			width: 390rpx;
			height: 240rpx;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-around;
			align-items: center;
			.top_main_right_left{
				.top_main_right_item{
					display: flex;
					flex-direction: column;
					margin-top: 10rpx;
					.text{
						font-weight: 400;
						font-size: 28rpx;
						color: #999999;
					}
					.price{
						display: flex;
						align-items: center;
						margin-top: 10rpx;
						>image{
							width: 24rpx;
							height: 24rpx;
							margin-right: 5rpx;
						}
						>text{
							font-weight: 400;
							font-size: 32rpx;
							color: #A68A64;
						}
					}
				}
			}

		}
		
	}
	.tit{
		margin-top: 40rpx;
		margin-left: 28rpx;
		font-weight: 400;
		font-size: 32rpx;
		color: #666666;
	}
	.main_item{
		width: 690rpx;
		margin: 0 auto;
		margin-top: 56rpx;
		height: 124rpx;
		.main_item_top{
			width: 690rpx;
			display: flex;
			justify-content: space-between;
			  .text{
				  font-weight: 400;
				  font-size: 30rpx;
				  color: #A68A64;
				  max-width: 470rpx;
				  white-space: nowrap; /* 文本不换行 */
				  overflow: hidden; /* 溢出隐藏 */
				  text-overflow: ellipsis; /* 使用省略号 */
			  }
			>.text2{
				font-weight: 400;
				font-size: 30rpx;
				color: #A68A64;
				margin-left: 20rpx;
			}
		}
		.main_item_bottom{
			display: flex;
			justify-content: space-between;
			align-items: center;
			.text_one{
				font-weight: 400;
				font-size: 26rpx;
				color: #A6A5AF;
				margin-top: 20rpx;
			}
			.price_wrap{
				display: flex;
				align-items: center;
				>image{
					width: 24rpx;
					height: 24rpx;
				}
				>text{
					font-weight: 400;
					font-size: 32rpx;
					color: #A68A64;
					margin-left: 10rpx;
				}
			}
		}
	}
</style>